<?php

namespace Kateba\RestaurantBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Kateba\RestaurantBundle\Entity\Ingredient
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Kateba\RestaurantBundle\Entity\IngredientRepository")
 */
class Ingredient {

    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var Doctrine\Common\Collections\ArrayCollection $food
     * 
     * @ORM\ManyToMany(targetEntity="\Kateba\RestaurantBundle\Entity\Food", inversedBy="ingradients")
     * @ORM\JoinTable(name="food_ingradient",
     *      joinColumns={@ORM\JoinColumn(name="ingredientId", referencedColumnName="id", onDelete="CASCADE", onUpdate="CASCADE", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="foodId", referencedColumnName="id", onDelete="CASCADE", onUpdate="CASCADE", nullable=false)}
     *      )
     */
    private $food;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name) {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName() {
        return $this->name;
    }

    public function __construct() {
        $this->food = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add food
     *
     * @param Kateba\RestaurantBundle\Entity\Food $food
     */
    public function addFood(\Kateba\RestaurantBundle\Entity\Food $food) {
        $this->food[] = $food;
    }

    /**
     * Get food
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getFood() {
        return $this->food;
    }

}